package com.qiuhu.javase.innerclass;

/**
 * 匿名内部类
 * @author Administrator
 *
 */
public class AnonymousInnerClass {

	public InnerClass getInnerClass(final int num, int str) {
		return new InnerClass() {
			int number = num + 3;
			@Override
			public int getNumber() {
				return number + str;
			}
		};
	}
	
	public static void main(String[] args) {
		AnonymousInnerClass outerClass = new AnonymousInnerClass();
		InnerClass innerClass = outerClass.getInnerClass(2, 666);
		System.out.println(innerClass.getNumber());
	}
	
}

interface InnerClass{
	int getNumber();
}
